package com.dianping.cat.consumer.problem.model.entity;

import com.dianping.cat.consumer.problem.model.BaseEntity;
import com.dianping.cat.consumer.problem.model.IVisitor;
import java.util.LinkedHashMap;
import java.util.Map;






public class Entity
  extends BaseEntity<Entity>
{
  private String m_id;
  private String m_type;
  private String m_status;
/*  19 */   private Map<String, JavaThread> m_threads = new LinkedHashMap();

/*  21 */   private Map<Integer, Duration> m_durations = new LinkedHashMap();



  private GraphTrend m_graphTrend;



  public Entity(String id) { this.m_id = id; }




/*  34 */   public void accept(IVisitor visitor) { visitor.visitEntity(this); }


  public Entity addDuration(Duration duration) {
/*  38 */     this.m_durations.put(Integer.valueOf(duration.getValue()), duration);
/*  39 */     return this;
  }

  public Entity addThread(JavaThread thread) {
/*  43 */     this.m_threads.put(thread.getId(), thread);
/*  44 */     return this;
  }


  public boolean equals(Object obj) {
/*  49 */     if (obj instanceof Entity) {
/*  50 */       Entity _o = (Entity)obj;

/*  52 */       if (!equals(getId(), _o.getId())) {
/*  53 */         return false;
      }

/*  56 */       return true;
    }

/*  59 */     return false;
  }


/*  63 */   public Duration findDuration(int value) { return (Duration)this.m_durations.get(Integer.valueOf(value)); }



/*  67 */   public JavaThread findThread(String id) { return (JavaThread)this.m_threads.get(id); }


  public Duration findOrCreateDuration(int value) {
/*  71 */     Duration duration = (Duration)this.m_durations.get(Integer.valueOf(value));

/*  73 */     if (duration == null) {
/*  74 */       synchronized (this.m_durations) {
/*  75 */         duration = (Duration)this.m_durations.get(Integer.valueOf(value));

/*  77 */         if (duration == null) {
          duration = new Duration(value);
/*  79 */           this.m_durations.put(Integer.valueOf(value), duration);
        }
      }
    }

/*  84 */     return duration;
  }

  public JavaThread findOrCreateThread(String id) {
/*  88 */     JavaThread thread = (JavaThread)this.m_threads.get(id);

/*  90 */     if (thread == null) {
/*  91 */       synchronized (this.m_threads) {
/*  92 */         thread = (JavaThread)this.m_threads.get(id);

/*  94 */         if (thread == null) {
/*  95 */           thread = new JavaThread(id);
/*  96 */           this.m_threads.put(id, thread);
        }
      }
    }

/* 101 */     return thread;
  }


/* 105 */   public Map<Integer, Duration> getDurations() { return this.m_durations; }



/* 109 */   public GraphTrend getGraphTrend() { return this.m_graphTrend; }



/* 113 */   public String getId() { return this.m_id; }



/* 117 */   public String getStatus() { return this.m_status; }



/* 121 */   public Map<String, JavaThread> getThreads() { return this.m_threads; }



/* 125 */   public String getType() { return this.m_type; }






  public void mergeAttributes(Entity other) {
/* 139 */     assertAttributeEquals(other, "entity", "id", this.m_id, other.getId());

/* 141 */     if (other.getType() != null) {
/* 142 */       this.m_type = other.getType();
    }

/* 145 */     if (other.getStatus() != null) {
/* 146 */       this.m_status = other.getStatus();
    }
  }


/* 151 */   public Duration removeDuration(int value) { return (Duration)this.m_durations.remove(Integer.valueOf(value)); }



/* 155 */   public JavaThread removeThread(String id) { return (JavaThread)this.m_threads.remove(id); }


  public Entity setGraphTrend(GraphTrend graphTrend) {
/* 159 */     this.m_graphTrend = graphTrend;
/* 160 */     return this;
  }

  public Entity setId(String id) {
/* 164 */     this.m_id = id;
/* 165 */     return this;
  }

  public Entity setStatus(String status) {
/* 169 */     this.m_status = status;
/* 170 */     return this;
  }

  public Entity setType(String type) {
/* 174 */     this.m_type = type;
/* 175 */     return this;
  }

  public Entity() {}
}


/* Location:              /Users/hanfei/Documents/apache-tomcat-9.0.24/webapps/cat/WEB-INF/lib/cat-consumer-3.0.0.jar!/com/dianping/cat/consumer/problem/model/entity/Entity.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       1.0.7
 */